// pages/help/help.js
const app = getApp();
Page({

    /**
     * 页面的初始数据
     */
    data: {
        banner: '/banner4.gif',
        country: ["社区（村）", "龙江社区", "麦郎", "东头村", "东海村", "陈涌", "万安", "排沙", "新华西", "旺岗村", "集北", "西庆", "世埠", "苏溪", "南坑", "沙富",
            "龙山", "左滩", "官田", "文华", "仙塘"],
        dicuss: ["困难程度", "低保", "三无", "孤儿", "低保临界", "五保", "普惠儿童", "困难家庭", "特困（三无）", "特困人员", "单亲困难家庭", "重病", "事实无人抚养"],
        things : ["圆梦物资", "电视机", "衣柜", "洗衣机","消毒碗柜","直饮水机","电饭煲","电磁炉","抽湿机","床","衣柜","抽湿机","餐桌","电风扇","沙发","茶柜","电水壶","单车","电冰箱","轮椅","书柜","其他"],
        dIndex: 0,
        cIndex: 0,
        tIndex: 0,
        list: [
            {
                pic: '/listImg2.png',
                title: '2020年“龙江仁·爱龙江”公益微创投项目结项评估会顺利举行',
                desc: '为完善龙江困难家庭资助工作，让低收入家庭长者老有所养，根据《龙江慈善会章程》等有等有等有等有等有等有等有',
                status: true
            },
            {
                pic: '/listImg2.png',
                title: '2021年“龙江仁·爱龙江”公益微创投项目结项评估会顺利举行',
                desc: '为完善龙江困难家庭资助工作，让低收入家庭长者老有所养，根据《龙江慈善会章程》等有等有等有等有等有等有等有',
                status: false
            }
        ]
    },
    bindCountryChange: function (e) {
        this.setData({
            cIndex: e.detail.value
        })
        this.changData();
    },
    bindDicussChange: function (e) {
        this.setData({
            dIndex: e.detail.value
        })
        this.changData();
    },
    bindThingsChange: function (e) {
        this.setData({
            tIndex: e.detail.value
        })
        this.changData();
    },

    
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.changData();


    },
    helpDetail: function (a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
          url: "/pages/helpDetail/helpDetail?id=" + t 
        });
      },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {


    },
    changData: function () {
        var openid = wx.getStorageSync("openid");
        var that = this;
        wx.request({
            url: app.globalData.baseUrl + '/api/index/getOneList',
            header: {
                'content-type': 'application/json'
            },
            data:{
                'type':that.data.dIndex,
                'cun_type':that.data.cIndex,
                'wz_type':that.data.tIndex,
                'openid':openid
            },
            method:'POST',
            success: res => {
                console.log(res.data)
                if(res.data.data==''){
                    console.log('无数据')
                    this.setData({
                        list: res.data.data,
                        show:false
                    })
                }else{
                    this.setData({
                        list: res.data.data,
                        baseUrl: app.globalData.baseUrl,
                        show:true
                    })
                }
                
            }
        })

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {
        var that = this;
        return {
          title: '和善龙江 一对一帮扶',
          path:'/pages/main/main',
           imageUrl: 'http://cdn2.kyhdmedia.com/xcx_ljcs/share.jpg'
        }
      }
})